remove space from start and end of string in php

55

php remove space before and after string -

$words = '      my words     ';
$words = trim($words);
var_dump($words);
// string(8) "my words"

remove space from start and end of string in php -

 
$trimmed = trim($text);
var_dump($trimmed);

 

Comments

Submit
0 Comments